import http from '@/config/axios'
const preUrl = '/v1/pc/api'

// 算法管理
const baseUrl = '/v1/pc/api/algorithm';
// 1.01 主键查询
export const queryById = id => http.get(`${baseUrl}/${id}`);
// 1.02 分页查询
export const queryByPage = data => http.get(`${baseUrl}`, { params: data });
// 1.03 查询所有
export const getAllAlgorithm = () => http.get(`${baseUrl}/queryAll`);
// 2.01 数据新增
export const addData = data => http.post(`${baseUrl}`, data);
// 3.01 部分修改
export const updateData = (id, data) => http.patch(`${baseUrl}/${id}`, data);
// 4.01 删除数据
export const delData = id => http.delete(`${baseUrl}/${id}`);

// 算法版本管理
const versionUrl = '/v1/pc/api/algorithmVersion';
// 1.01 主键查询
export const queryVersionById = id => http.get(`${versionUrl}/${id}`);
// 1.02 分页查询
export const queryVersionByPage = data => http.get(`${versionUrl}`, { params: data });
// 1.03 查询所有
export const getVersionAll = data => http.get(`${versionUrl}/queryAll`, { params: data });
// 2.01 数据新增
export const addVersionData = data => http.post(`${versionUrl}`, data);
// 3.01 部分修改
export const updateVersionData = (id, data) => http.patch(`${versionUrl}/${id}`, data);
// 4.01 删除数据
export const delVersionData = id => http.delete(`${versionUrl}/${id}`);

// 组织机构管理
const organizeUrl = '/v1/pc/api/org';
// 1.01 查询机构详情
export const getOrganizeDetail = id => http.get(`${organizeUrl}/${id}`);
// 1.02 分页查询列表
export const getOrganizeList = data => http.get(`${organizeUrl}/query`, { params: data });
// 1.03 查询所有组织
export const getAllOrganize = data => http.get(`${organizeUrl}/queryAll`, { params: data });
// 2.01 新增组织
export const addOrganize = data => http.post(`${organizeUrl}`, data);
// 3.01 部分修改
export const updateOrganize = (id, data) => http.patch(`${organizeUrl}/${id}`, data);
// 4.01 删除机构
export const delOrganize = id => http.delete(`${organizeUrl}/${id}`);

// 查询部门下所有用户
export const queryByCode = code => http.get(`${userUrl}/queryByCode/${code}`);

// 用户管理
const userUrl = '/v1/pc/api/user';
// 1.01 查询用户详情
export const getUserDetail = id => http.get(`${userUrl}/${id}`);
// 1.02 分页查询列表
export const getUserList = data => http.get(`${userUrl}`, { params: data });
// 1.03 查询所有用户
export const getAllUser = data => http.get(`${userUrl}/queryAll`, { params: data });
// 2.01 新增用户
export const addUser = data => http.post(`${userUrl}`, data);
// 3.01 修改用户
export const editUser = (id, data) => http.patch(`${userUrl}/${id}`, data);
// 根据部门code查询用户
export const getUserByDept = id => http.get(`${userUrl}/queryByOrgId/${id}`)
// 根据部门id查询管理员和负责人
export const getAdminAndChargeByOrgId = id => http.get(`${userUrl}/queryAdminAndChargeByOrgId/${id}`)

// 角色管理
const roleUrl = '/v1/pc/api/role';
// 1.01 查询用户详情
export const getRoleDetail = id => http.get(`${roleUrl}/${id}`);
// 1.02 分页查询角色列表
export const getRoleList = data => http.get(`${roleUrl}`, { params: data });
// 1.03 查询所有角色
export const getAllRole = data => http.get(`${roleUrl}/queryAll`, { params: data });
// 2.01 新增角色
export const addRole = data => http.post(`${roleUrl}`, data);
// 3.01 修改角色
export const editRole = (id, data) => http.patch(`${roleUrl}/${id}`, data);

// 用户角色管理
const userRoleUrl = '/v1/pc/api/userRole';
// 1.02 根据userId去查用户角色
export const getUserRoles = data => http.get(`${userRoleUrl}`, { params: data });
// 2.01 修改用户角色-这里使用post，也就是新增接口
export const editUserRole = data => http.post(`${userRoleUrl}`, data);
// 1.03 查询用户当前所有角色
export const getUserAllRoles = (data) => http.get(`${userRoleUrl}/queryAll`, { params: data })

// 权限管理
const permissionUrl = '/v1/pc/api/resources';
// 查询菜单树
export const getPermissionTree = data => http.get(`${permissionUrl}/queryResourcesTree`, { params: data });
// 2.01 新增资源
export const addPermission = data => http.post(`${permissionUrl}`, data);
// 1.03 查询所有资源
export const getAllPermission = data => http.get(`${permissionUrl}/queryAll`, { params: data });
// 获取当前登录用户权限菜单
export const getUserPermission = data => http.get(`${permissionUrl}/queryResourcesTreeByCurrentUserId`, { params: data });

// 角色权限管理
const RolePermissionUrl = '/v1/pc/api/roleRes';
// 1.01 查询角色权限
export const getRolePermissionDetail = id => http.get(`${RolePermissionUrl}/${id}`);
// 1.01 查询角色权限
export const getRolePermission = data => http.get(`${RolePermissionUrl}`, { params: data });
// 2.01 新增角色权限
export const addRolePermission = data => http.post(`${RolePermissionUrl}`, data);

// 参数管理
const dictUrl = '/v1/pc/api/dict';
// 1.01 获取参数列表
export const getDictDetail = id => http.get(`${dictUrl}/${id}`);
// 1.02 获取参数列表
export const getDictList = data => http.get(`${dictUrl}`, { params: data });
// 2.01 新增参数
export const addParams = data => http.post(`${dictUrl}`, data);
// 3.01 修改参数
export const editParams = (id, data) => http.patch(`${dictUrl}/${id}`, data);
// 4.01 删除参数
export const delParams = id => http.delete(`${dictUrl}/${id}`);

// 参数管理-查看详情-子参数管理
const subDictUrl = '/v1/pc/api/dictVal';
// 1.01 获取子参数详情
export const getSubDictDetail = id => http.get(`${subDictUrl}/${id}`);
// 1.02 查询子参数列表
export const getSubDictList = data => http.get(`${subDictUrl}`, { params: data });
// 2.01 新增子参数
export const addSubParams = data => http.post(`${subDictUrl}`, data);
// 3.01 修改参数
export const editSubParams = (id, data) => http.patch(`${subDictUrl}/${id}`, data);
// 4.01 删除子参数
export const delSubParams = id => http.delete(`${subDictUrl}/${id}`);

// 日志管理
const logUrl = '/v1/pc/api/log';
// 1.02 查询日志列表
export const getLogList = data => http.get(`${logUrl}`, { params: data });

// 诊改对象管理
const objectUrl = '/v1/pc/api/rectificationObject'
// 1.02 查询列表
export const getRectificationObjectList = data => http.get(`${objectUrl}`, { params: data });
